<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
<script src="deferred-promise-utils.js"></script>
<script src="webspeech.js"></script>

<script>
const params = new URLSearchParams(location.search);

// The main test page (restriction-speech-recognition.https.html) loads the
// initiator page, then the initiator page will prerender itself with the
// `prerendering` parameter.
const isPrerendering = params.has('prerendering');

if (!isPrerendering) {
  loadInitiatorPage();
} else {
  const prerenderEventCollector = new PrerenderEventCollector();
  const promise = new Promise((resolve, reject) => {
    const reco = new webkitSpeechRecognition();
    reco.onstart = () => { resolve(); }
    reco.onerror = (e) => { reject(); }
    reco.start();
  });
  prerenderEventCollector.start(promise, 'SpeechRecognition');
}

</script>
